//
//  GameObject.h
//  RenderV1
//
//  Created by 黄翔 on 2019/10/20.
//  Copyright © 2019 黄翔. All rights reserved.
//

#ifndef GameObject_h
#define GameObject_h

#include "Component.h"
#include "Transform.h"
#include "ReferenceCounted.h"

namespace hxe
{
    class Component;
    class Transform;

    class GameObject : public ReferenceCounted
    {
    public:
        std::string name;
        Transform* transform;
        int layer;
        std::string tag;
        
        void addComponent(Component* component);
        Component* getComponent(std::string name);
        void changeLayer(int layer, bool includeChildren);
        void update();
        void draw();
        
    public:
        GameObject(std::string name);
        ~GameObject();
    private:
        static unsigned int genInstanceId;
        unsigned int instanceId;
        
        Component* components;
    };
}

#endif /* GameObject_h */
